#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>

#include "../utility/ugx_palloc.h"
#include "request.h"

request_t* request_new()
{
    request_t* request = NULL;

    request = (request_t*)calloc(1, sizeof(request_t));

    return request;
}

void request_free(request_t* request)
{
    assert(request != NULL);

    if (request == NULL){
        return;
	}

    if (request->userdata != NULL && request->userdata_destroy != NULL) {
        request->userdata_destroy(request->userdata);
    }

    if (request->pool != NULL) {
        _destroy_pool(request->pool);
    }

/*
	if (request->sockfd > 0) {
		close(request->sockfd);
	}
	*/

    free(request);
	request = NULL;
}
